$OpenBSD: patch-rpython_jit_backend_x86_detect_feature_py,v 1.1 2016/08/15 09:16:40 edd Exp $

Make the CPython bootstrap W^X compatible.

--- rpython/jit/backend/x86/detect_feature.py.orig	Tue Jun 14 08:46:04 2016
+++ rpython/jit/backend/x86/detect_feature.py	Thu Aug 11 08:49:22 2016
@@ -1,17 +1,20 @@
 import sys
 import struct
 from rpython.rtyper.lltypesystem import lltype, rffi
-from rpython.rlib.rmmap import alloc, free
+from rpython.rlib.rmmap import alloc, free, set_pages_executable
 
+CPU_INFO_SZ = 4096
+
 def cpu_info(instr):
-    data = alloc(4096)
+    data = alloc(CPU_INFO_SZ, no_exec=True)
     pos = 0
     for c in instr:
         data[pos] = c
         pos += 1
     fnptr = rffi.cast(lltype.Ptr(lltype.FuncType([], lltype.Signed)), data)
+    set_pages_executable(data, CPU_INFO_SZ)
     code = fnptr()
-    free(data, 4096)
+    free(data, CPU_INFO_SZ)
     return code
 
 def detect_sse2():
